package org.news.web.utils;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class UserBehaviorModel {
    // 用户ID
    private String userId;
    // 用户对新闻的行为
    private Map<String, NewsBehavior> newsBehaviors;
    // 订阅的栏目
    private Set<String> subscribedChannels;

    // 订阅的作者
    private Set<String> creatorsChannels;

    public UserBehaviorModel(String userId) {
        this.userId = userId;
        this.newsBehaviors = new HashMap<>();
        this.subscribedChannels = new HashSet<>();
        this.creatorsChannels = new HashSet<>();
    }

    // 添加新闻行为
    public void addNewsBehavior(NewsBehavior behavior) {
        newsBehaviors.put(behavior.getNewsId(), behavior);
    }

    // 获取用户ID
    public String getUserId() {
        return userId;
    }

    // 获取新闻行为
    public Map<String, NewsBehavior> getNewsBehaviors() {
        return newsBehaviors;
    }

    // 添加订阅频道
    public void addSubscribedChannel(String channel) {
        subscribedChannels.add(channel);
    }

    //
    public void addCreatorsChannels(String channel){ creatorsChannels.add(channel);}

    // 获取订阅频道
    public Set<String> getSubscribedChannels() {
        return subscribedChannels;
    }
}

